<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="minimal-ui,width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>{$data.goods_name}-{$webseting.web_title}</title>
    <link href="__PUBLIC__/wap/css/rest.css"  rel="stylesheet">
    <link href="__PUBLIC__/wap/css/product.css"  rel="stylesheet">
    <link href="__PUBLIC__/wap/css/service.css"  rel="stylesheet">
</head>
<body>
    <header id="header" class="u-header clearfix">
        <div class="u-hd-left f-left">
            <a href="javascript:history.go(-1);" class="J_backToPrev"><span class="u-icon-px i-hd-back"></span></a>
        </div>
        <div class="u-hd-tit"><span>服务详情</span></div>
    </header>
    <article>
        <section class="detail-image-wrap">
            <div class="slider">
                    <ul>
                        <li><a href="javascript:void(0);" target="_blank"><img src="{$data.goods_image}" alt=""></a></li>
                         <volist name="data['goods_image_url']" id="vo">
                     <li><a href="javascript:void(0);" target="_blank"><img src="{$vo}" alt=""></a></li>
                         </volist>
                    </ul>
                </div>
           <!--  <div class="detail-image">
               <a href="#" class="image-wrap">
                   <img src="img/023.jpg" alt="华莱士25.1双人套餐">
               </a>
           </div> -->
           <div class="pd_product-title-wrap">
                    <div class="pd_product-title-box">
                        <h2 class="pd_product-title title" id="pd_product-title" title="">{$data.goods_name}</h2>
                        <h3 class="pd_product-subtitle" id="pd_product-subtitle" title="">{$data.goods_jingle}</h3>
                        <div class="pd_product-price" id="current_price">
                            <span class="pd_product-price-yen">¥</span>
                            <strong class="pd_product-price-num">{$data.goods_price}</strong>
                        </div>
                    </div>
                    <a href="javascript:;" class="pd_product-collect" data="{$data.id}" data-type='{$collect}' id="pd_product-collect" data-tpa="H5_DETAIL_STOREUP" data-trackersend="1">
                        <span class="pd_product-collect-text pd_product-collect-text_not collect_text"><if condition="$collect gt 0">已收藏<else/>收藏</if></span>
                        <span class="pd_product-collect-text pd_product-collect-text_yes">已收藏</span>
                    <span class="pd_product-collect-text" id="detailFavNums" nums="{$data.goods_collect}">{$data.goods_collect}</span>
                    </a>
                </div>

           <!--  <div class="title-wrap"><h3 class="title">{$data.goods_name}</h3>
               <p class="desc">{$data.goods_jingle}</p></div> -->
        </section>
        <section>
            <div class="merchant-info">
                <div class="merchant-cnt">
                    <a href="#">
                        <h4 class="title">{$shop.shop_name}</h4>
                        <p class="address">{$shop.addr}</p>
                    </a>
                    <div class="other">
                        <a href="tel:{$shop.link_no}" class="tel">电话:{$shop.link_no}</a>
                    </div>
                </div>
            </div>
        </section>
        <section class="panel-taocan">
            <div class="hd">套餐内容</div>
            <div id="j-ajax-struct-taocan">
                <div class="struct-data">
                   {$data.goods_body}
                </div></div>
        </section>
        <section class="panel-notice">
            <div class="hd">消费提示</div>
            <div class="struct-data">
               {$data.goods_content}
            </div>
            <div style="margin-bottom: 60px;"></div>
        </section>

        <section class="buy-btn-wrap">
            <div class="buy-segment">
            <span class="old-current-price">
            <em class="price-value">{$data.goods_price}</em>
            </span>
            <span class="original-price">
            <del>￥{$data.goods_z_price}</del>
            </span>
                <div class="buy-wrapper">

                     <input type="hidden" name="good_num" class="fm-txt good_num" value="1" id="number">
                      <input type="hidden" name="goods_id" value="{$data.id}" > 
                   <input type="hidden" name="shop_id" value="{$data.shop_id}" > 
                    <div class="privilege-btn">
                        <a href="javascript:void(0);" class="buy-btn go_pay">
                            <span class="tip">活动价</span>
                            <span class="privilege"><em class="price">{$data.goods_z_price}</em></span>
                            <span class="text">立即抢购</span>
                        </a>
                    </div>

                </div>
            </div>
        </section>

    </article>
  <script src="__PUBLIC__/bootstrap/vendor/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/wap/js/yxMobileSlider.js"></script>
    <script type="text/javascript" src="__PUBLIC__/layer/layer.js"></script>
    <script>
        $(".slider").yxMobileSlider({width:630,height:320,during:3000})
    </script>

<script type="text/javascript">
   $(function(){
    //收藏
    $("#pd_product-collect").click(function(){
        var _this=$(this);
         var goods_id=_this.attr('data');
          var type=_this.attr('data-type');
           $.ajax({ 
            url: "{:U('wap/group/good_collect')}",
            type:'post',
            data: {goods_id:goods_id},
            dataType: 'json',
            success: function(data){
              if(data.status==1){
                if(type>0){
                    layer.msg("取消成功",{icon:6})
                    $(".collect_text").html('收藏');
                    _this.attr('data-type',0);
                     var sc=parseInt($('#detailFavNums').html());
                    $('#detailFavNums').html(sc-1);
                }else{
                    layer.msg("收藏成功",{icon:6})
                    $(".collect_text").html('已收藏');
                    _this.attr('data-type',1)
                    var sc=parseInt($('#detailFavNums').html());
                    $('#detailFavNums').html(sc+1);
                }
              }else{
                layer.msg(data.error,{icon:5})
              }
            }
           });
     });
    //增加数量
     $(".add_good").click(function(){
         var _this_num=$(".good_num");
          var goods_num=_this_num.val();
          goods_num++;
          _this_num.val(goods_num)
            //计算商品价格  
         
     });
     //减少数量
     $(".save_good").click(function(){
          var _this_num=$(".good_num");
          var goods_num=_this_num.val();
          goods_num--;
          if(goods_num<=0){
          }else{
             _this_num.val(goods_num)
          }
          //计算商品价格  
        
     }); 
    $(".go_pay").click(function(){
         var _this_num=$(".good_num");
          var all_num=_this_num.val();
          all_num=parseInt(all_num);
          if(all_num>0){
            var good_id=$("input[name='goods_id']").val();
            var shop_id=$("input[name='shop_id']").val();
            var url="<?php echo U('Wap/order/order_add'); ?>?good_id="+good_id+'|'+all_num+"&shop_id="+shop_id;
            window.location.href=url;
          }
     }); 

   });
  
 //计算商品价格  
function get_goods_price(){
    var discount_consume=$('input[name="discount_consume"]').val();
    discount_consume=parseFloat(discount_consume);
    if(discount_consume<=0){
        discount_consume=1;
    }
    var total=parseFloat(0);
    var all_num=0;
    var goods_id_str='';
    $(".good_num").each(function(){
        var num=$(this).val();
        num=parseInt(num);
        if(num>0){
            var goods_id=$(this).attr('data');
            var good_price=$(".good_price_"+goods_id).val();
            good_price=parseFloat(good_price);
            total=total+good_price*num;
            goods_id_str=goods_id_str+','+goods_id+'|'+num;
            all_num=all_num+num;
        }
    });
    if(goods_id_str){
        goods_id_str=goods_id_str.substr(1);
    }
    if(total>0){
        $('.go_pay').removeAttr('style');
    }else{
        $('.go_pay').css('cssText','background-color:rgb(171, 168, 168) !important;');
    }
    $('.all_price').html('￥'+total);
    $('.total').html(total);
    var discount_price=discount_consume*total;
    discount_price=discount_price.toFixed(2);
    $('.discount_consume_price').html(discount_price);
    $('input[name="goods_id"]').val(goods_id_str);
    $('.all_num').html(all_num);
}
</script>     
</body>
</html>